package com.dc.entity;

import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dc.model.Device;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * 工单主表
 *
 * @author feishaobin
 * @email
 * @date 2021-12-30 17:01:23
 */
@Data
@ApiModel
@TableName("dc_work_order")
public class WorkOrder implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "工单类型 0:故障 1:维保 2:报修 3:隐患 4:巡检 5:火警")
    private Integer type;

    @ApiModelProperty(value = "故障/维保/报修/隐患/火警 工单状态 0：待处理 1：处理中 2：已完成   巡检状态:0:巡检中 2:完成")
    private Integer status;

    @ApiModelProperty(value = "报修/隐患/维保: 联系方式")
    private String mobile;

    @ApiModelProperty(value = "报告人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long reportUserId;

    @ApiModelProperty(value = "报告人姓名")
    private String reportUserName;

    @ApiModelProperty(value = "报修/隐患/维保/火警 : 工单编号")
    private String number;


    @ApiModelProperty(value = "区域id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long regionId;

    @ApiModelProperty(value = "报修/隐患/维保 : 区域位置")
    private String regionName;

    @ApiModelProperty(value = "故障/报修/隐患 :描述 火警：报警描述 巡检：巡检备注")
    private String description;

    @ApiModelProperty(value = "报修/维保 ：设备状态 0:正常 1:故障")
    private String deviceStatus;

    @ApiModelProperty(value = "报修/维保/隐患: 值班人员id 火警：接警人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long dutyUserId;

    @ApiModelProperty(value = "报修/维保/隐患: 值班人员姓名 火警：接警人")
    private String dutyUserName;

    @ApiModelProperty(value = "隐患: 隐患等级")
    private String grade;

    @ApiModelProperty(value = "隐患:隐患因素")
    private String factor;

    @ApiModelProperty(value = "隐患:整改措施 火警：预案内容")
    private String recContent;

    @ApiModelProperty(value = "隐患:整改人id  维保:维保人id 报修:维修人id 巡检:巡检人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @ApiModelProperty(value = "隐患:整改人姓名  维保:维保人姓名 报修:维修人姓名 巡检:巡检人姓名")
    private String userName;

    @ApiModelProperty(value = "隐患: 本次整改时间 维保: 本次维保时间 报修:本次维修时间 火警:通知时间")
    private Date recTime;

    @ApiModelProperty(value = "隐患:整改状态 0：已完成 1：未完成")
    private Integer recStatus;

    @ApiModelProperty(value = "报修/火警 :设备唯一序列号")
    private String serialNumber;

    @ApiModelProperty(value = "报修:设备名称")
    private String deviceName;

    @ApiModelProperty(value = "报修:设备型号")
    private String deviceModel;

    @ApiModelProperty(value = "报修:维修内容 火警：火警情况原因")
    private String repairContent;

    @ApiModelProperty(value = "报修:维保结果 0：已完成 1：未完成")
    private Integer repairStatus;

    @ApiModelProperty(value = "隐患：整改信息记录 报修:维修信息记录 维保：维保信息记录 火警：火警报告")
    private String repairRecord;

    @ApiModelProperty(value = "报修/火警 :上报形式  0:系统  1：人工")
    private Integer repairType;

    @ApiModelProperty(value = "维保:下次维保时间")
    private Date nextTime;

    @ApiModelProperty(value = "巡检 : 路线id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long routeId;

    @ApiModelProperty(value = "巡检 :路线名称")
    private String routeName;

    @ApiModelProperty(value = "巡检开始时间")
    private Date startTime;

    @ApiModelProperty(value = "巡检结束时间")
    private Date endTime;

    @ApiModelProperty(value = "应巡点位数量")
    private Integer needNum;

    @ApiModelProperty(value = "已巡点位数量")
    private Integer alreadyNum;

    @ApiModelProperty(value = "接警时间")
    private Date alarmTime;

    @ApiModelProperty(value = "直属领导")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long leaderUserId;

    @ApiModelProperty(value = "直属领导姓名")
    private String leaderUserName;

    @ApiModelProperty(value = "创建时间(上报时间取创建时间)")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField(exist = false)
    @ExcelCollection(name = "维保项目详情")
    private List<MaintenanceRelation> maintenanceInfo = Collections.EMPTY_LIST;

    @TableField(exist = false)
    @ApiModelProperty(value = "附件信息")
    private List<WorkOrderFile> Files = Collections.EMPTY_LIST;

    @TableField(exist = false)
    @ApiModelProperty(value = "巡检区域信息")
    private List<String> regionIds;

    @ApiModelProperty(value = "消防值班员编号")
    private Long dutyPersonId;

    @ApiModelProperty(value = "消防值班员")
    private String dutyPersonName;

    @TableField(exist = false)
    @ApiModelProperty(value = "设备信息")
    private Device device;

    @ApiModelProperty(value = "设备所在位置")
    private String deviceAddress;

}
